<template>
	<view class="page">
		<view class="top">
			<image src="/static/jiujiu.png"></image>
			<view class="t_head">
				<view class="t_tit">CHIO.TURER</view>
				<view class="t_tag">韩国彩妆店铺</view>
				<view class="t_desc">236次分享</view>
			</view>
			<view class="t_btn">分享会场</view>
		</view>
		<view class="list">
			<view class="item" v-for="item in goodsList" @click="$navTo('/pages/taobao/detail?id='+item.product_id+'&type='+bigcate)">
				<view class="logo">
					<image :src="item.thumb" v-if="bigcate==1"></image>
					<image :src="item.cover" v-if="bigcate==2"></image>
				</view>
				<view class="content">
					<view class="title">
						<view class="tag tag_red" v-if="bigcate==1">拼多多</view>
						<view class="tag tag_black" v-if="bigcate==2">抖音</view>
						<text>{{item.title}}</text>
					</view>
					<view class="tags">
						<text class="tag" v-if="item.couponPrice>0">券 ￥{{item.couponPrice}}</text>
						<text class="tag" v-if="bigcate==1&&item.cos_fee>=0">返现 ￥{{item.cos_fee}}</text>
						<text class="tag" v-if="bigcate==2&&item.cosFee>=0">返现 ￥{{item.cosFee}}</text>
					</view>
					<view class="price">
						<text class="new">￥{{item.realprice}}</text>
						<text class="old">￥{{item.realprice}}</text>
					</view>
				</view>
			</view>
		</view>
		<view class="empty_loading">
			<image v-show="isloading" src="../../static/business/loading.gif" mode=""></image>
			<text v-show="isempty">没有更多了~</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				isloading: false,
				isempty: false,
				bigcate: 2,//1拼多多 2抖音
				bigcateActive: 0,
				cateList: [],
				goodsList: [],
				page:0,
			};
		},
		onLoad(){
			uni.setNavigationBarTitle({
				title: "大牌会场名称"
			})
			this.getList();
		},
		onShow(){
			if(!uni.getStorageSync('token')){
				uni.redirectTo({
					url: '/pages/public/login'
				})
			}
		},
		onReachBottom(){
			this.getList();
		},
		methods: {
			getList(){
				this.isempty = false;
				this.isloading = true;
				this.page++;
				let php = '';
				if(this.bigcate==1){
					php = "duoduo";
				}else if (this.bigcate==2){
					php = "douyin";
				}
				this.$axios('index/goodsList', 'POST', php,{
					page: this.page,
					cid: this.bigcateActive
				}).then(res => {
					this.isloading = false;
					if(res.data.code==200){
						this.goodsList = [...this.goodsList, ...res.data.data];
						this.isempty = res.data.data.length <= 0;
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	page{
		background: #FBF8FE;
		padding-bottom: 60rpx;
	}
	.top{
		background: linear-gradient( 180deg, #E3C7FF 0%, #F0E1FF 100%);
		padding: 40rpx 30rpx 60rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		image{
			width: 138rpx;
			height: 138rpx;
			border-radius: 12rpx;
			margin-right: 20rpx;
		}
		.t_head{
			flex: 1;
			.t_tit{
				font-size: 32rpx;
				font-weight: 600;
			}
			.t_tag{
				background: linear-gradient( 270deg, #8816E1 0%, #B92DF1 100%);
				height: 34rpx;
				line-height: 34rpx;
				border-radius: 8rpx;
				padding: 0 10rpx;
				font-size: 20rpx;
				color: #FFFFFF;
				display: inline-block;
				margin-bottom: 6rpx;
			}
			.t_desc{
				font-size: 24rpx;
				color: #999999;
			}
		}
		.t_btn{
			width: 154rpx;
			height: 52rpx;
			background: #8615E1;
			border-radius: 26rpx;
			font-size: 24rpx;
			color: #FFFFFF;
			text-align: center;
			line-height: 52rpx;
		}
	}
	.list{
		padding: 24rpx;
		display: flex;
		justify-content: space-between;
		flex-wrap: wrap;
		border-radius: 32rpx 32rpx 0rpx 0rpx;
		background: #FBF8FE;
		margin-top: -30rpx;
		.item{
			width: 340rpx;
			background: #fff;
			margin-bottom: 24rpx;
			border-radius: 12rpx;
			overflow: hidden;
			.logo{
				width: 100%;
				image{
					width: 100%;
					height: 300rpx;
				}
			}
			.content{
				padding: 5rpx 12rpx 10rpx;
				background: #fff;
			}
			.title{
				.tag{
					border-radius: 5rpx;
					color: #fff;
					font-size: 16rpx;
					position: absolute;
					left: 0;
					top: 4rpx;
					width: 56rpx;
					height: 34rpx;
					text-align: center;
					line-height: 34rpx;
				}
				.tag_red{
					background: #f40009;
				}
				.tag_black{
					background: #141414;
				}
				font-weight: bold;
				line-height: 1.4;
				overflow: hidden;
				text-overflow: ellipsis;
				word-break: break-all;
				display: -webkit-box;
				-webkit-box-orient: vertical;
				-webkit-line-clamp: 2;
				position: relative;
				text{
					word-wrap: break-all;
					white-space: pre-line;
					padding-left: 64rpx;
				}
			}
			.tags{
				margin-bottom: 15rpx;
				margin-top: 5rpx;
				.tag{
					// color: #ff3333;
					// border: 1rpx solid #ffdcdc;
					color: #8615E1;
					border: 1rpx solid #8615E1;
					font-size: 20rpx;
					border-radius: 4rpx;
					margin-right: 8rpx;
					font-weight: bold;
					padding: 0 4rpx;
				}
			}
			.price{
				.new{
					font-weight: bold;
					font-size: 32rpx;
					margin-right: 16rpx;
					color: #AF141D;
				}
				.old{
					text-decoration: line-through;
					color: #999999;
					font-size: 20rpx;
				}
			}
		}
	}
</style>
